function changeTabs(fragId){
	for(var i=1;i<4;i++){
		document.getElementById("fragment-"+i).style.display="none";
		document.getElementById("tab-"+i).style.backgroundImage="url(images/tab.png)";
	}
		document.getElementById("fragment-"+fragId).style.display="";

		document.getElementById("tab-"+fragId).style.backgroundImage="url(images/tab_hover.png)";
}




function setcityoptions(chosen)
{
	//document.getElementById("TestCity_tr").style.display="none";
	var selbox = document.getElementById('txtCCity');
	selbox.options.length = 0;
	selbox.style.width=180;
	if (chosen == "Andaman and Nicobar")
	 {
		////document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Port Blair ','Port Blair  101');
	}
	if (chosen == "Andhra Pradesh") 
	{
		////document.getElementById("TestCity_tr").style.display="";
			selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Anantapur ','Anantapur 102');
selbox.options[selbox.options.length] = new Option('Eluru ','Eluru 103');
selbox.options[selbox.options.length] = new Option('Guntur ','Guntur 104');
selbox.options[selbox.options.length] = new Option('Hyderabad / Secunderabad ','Hyderabad / Secunderabad 105');
selbox.options[selbox.options.length] = new Option('Kadappa ','Kadappa 106');
selbox.options[selbox.options.length] = new Option('Kakinada ','Kakinada 107');
selbox.options[selbox.options.length] = new Option('Karimnagar ','Karimnagar 108');
selbox.options[selbox.options.length] = new Option('Karnool ','Karnool 109');
selbox.options[selbox.options.length] = new Option('Khammam ','Khammam 110');
selbox.options[selbox.options.length] = new Option('Mahaboobnagar ','Mahaboobnagar 111');
selbox.options[selbox.options.length] = new Option('Nellore ','Nellore 112');
selbox.options[selbox.options.length] = new Option('Nizamabad ','Nizamabad 113');
selbox.options[selbox.options.length] = new Option('Ongole ','Ongole 114');
selbox.options[selbox.options.length] = new Option('Rajahmundri','Rajahmundri 115');
selbox.options[selbox.options.length] = new Option('Srikakulam ','Srikakulam 116');
selbox.options[selbox.options.length] = new Option('Tenali ','Tenali 117');
selbox.options[selbox.options.length] = new Option('Thirupathi ','Thirupathi 118');
selbox.options[selbox.options.length] = new Option('Vijayawada ','Vijayawada 119');
selbox.options[selbox.options.length] = new Option('Visakhapatnam ','Visakhapatnam 120');
selbox.options[selbox.options.length] = new Option('Vizianagaram ','Vizianagaram 121');
selbox.options[selbox.options.length] = new Option('Warangal ','Warangal 122');

	}
if (chosen == "Arunachal Pradesh")
	{
		////document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Itanagar  ','Itanagar  123');
		
	}
if (chosen == "Assam")
	{
		////document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Dibrugarh ','Dibrugarh  124');
		selbox.options[selbox.options.length] = new Option('Guwahati ','Guwahati  125');

		
	}
if (chosen == "Bihar") 
	{
		////document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Bettiah ','Bettiah 126');
selbox.options[selbox.options.length] = new Option('Bhagalpur ','Bhagalpur 127');
selbox.options[selbox.options.length] = new Option('Buxar ','Buxar 128');
selbox.options[selbox.options.length] = new Option('Darbhanga ','Darbhanga 129');
selbox.options[selbox.options.length] = new Option('Gaya','Gaya 130');
selbox.options[selbox.options.length] = new Option('Muzaffarpur ','Muzaffarpur 131');
selbox.options[selbox.options.length] = new Option('Nalanda ','Nalanda 132');
selbox.options[selbox.options.length] = new Option('Patna ','Patna 133');
selbox.options[selbox.options.length] = new Option('Samastipur ','Samastipur 134');
selbox.options[selbox.options.length] = new Option('Samastipur','Samastipur 134');

	}
if (chosen == "Chandigarh") 
	{
		////document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Chandigarh ','Chandigarh 135');

	}
	
	if (chosen == "Chattisgarh") 
	{
		////document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Bilaspur','Bilaspur 136');
selbox.options[selbox.options.length] = new Option('Korba ','Korba 137');
selbox.options[selbox.options.length] = new Option('Raipur','Raipur 138');


	}
if (chosen == "Goa") 
	{
		////document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Panaji ','Panaji 139');

	}
if (chosen == "Gujarat") 
	{
		////document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Ahmedabad ','Ahmedabad 140');
selbox.options[selbox.options.length] = new Option('Rajkot ','Rajkot 141');
selbox.options[selbox.options.length] = new Option('Surat ','Surat 142');
selbox.options[selbox.options.length] = new Option('Vadodara ','Vadodara 143');
selbox.options[selbox.options.length] = new Option('Anand ','Vadodara 143');
selbox.options[selbox.options.length] = new Option('Nadiyad ','Nadiyad 143');
selbox.options[selbox.options.length] = new Option('Gandhidham','Gandhidham 143');
selbox.options[selbox.options.length] = new Option('Gunagardh','Gunagardh 143');
selbox.options[selbox.options.length] = new Option('New Bhuj ','New Bhuj 143');
selbox.options[selbox.options.length] = new Option('Vadsad ','Vadsad 143');
selbox.options[selbox.options.length] = new Option('Vapi ','Vapi 143');
selbox.options[selbox.options.length] = new Option('Navsari ','Navsari 143');
selbox.options[selbox.options.length] = new Option('Palanpur ','Palanpur 143');

	}
if (chosen == "Haryana") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Bahadurgarh','Bahadurgarh 144');
selbox.options[selbox.options.length] = new Option('Faridabad','Faridabad 145');

	}
if (chosen == "Himachal Pradesh") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Dharamsala','Dharamsala 146');
selbox.options[selbox.options.length] = new Option('Shimla','Shimla 147');

	}
		
	if (chosen == "Jammu And Kashmir") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Srinagar','Srinagar 148');
		selbox.options[selbox.options.length] = new Option('Jammu','Jammu 231');

	}
	
	
if (chosen == "Jharkhand") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Bokaro Steel City ','Bokaro Steel City 149');
selbox.options[selbox.options.length] = new Option('Dhanbad','Dhanbad 150');
selbox.options[selbox.options.length] = new Option('Giridih ','Giridih 151');
selbox.options[selbox.options.length] = new Option('Hazaribagh ','Hazaribagh 152');
selbox.options[selbox.options.length] = new Option('Jamshedpur ','Jamshedpur 153');
selbox.options[selbox.options.length] = new Option('Ranchi ','Ranchi 154');

	}
if (chosen == "Karnataka") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Bangalore ','Bangalore 155');
selbox.options[selbox.options.length] = new Option('Hubli ','Hubli 156');

	}
if (chosen == "Kerala") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Ernakulam ','Ernakulam 157');
selbox.options[selbox.options.length] = new Option('Kollam ','Kollam 158');
selbox.options[selbox.options.length] = new Option('Kottayam ','Kottayam 159');
selbox.options[selbox.options.length] = new Option('Kozhikodu','Kozhikodu 160');
selbox.options[selbox.options.length] = new Option('Palakkad ','Palakkad 161');
selbox.options[selbox.options.length] = new Option('Thiruvananthapuram ','Thiruvananthapuram 162');
selbox.options[selbox.options.length] = new Option('Thrissur ','Thrissur 163');

	}
if (chosen == "Madhya Pradesh") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Bhopal ','Bhopal 164');
selbox.options[selbox.options.length] = new Option('Gwalior ','Gwalior 165');
selbox.options[selbox.options.length] = new Option('Indore ','Indore 166');
selbox.options[selbox.options.length] = new Option('Katni ','Katni 167');
selbox.options[selbox.options.length] = new Option('Rajgarh','Rajgarh 168');

	}
if (chosen == "Maharashtra") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Mumbai ','Mumbai 169');
selbox.options[selbox.options.length] = new Option('Nagpur','Nagpur 170');
selbox.options[selbox.options.length] = new Option('Pune ','Pune 171');
selbox.options[selbox.options.length] = new Option('Nashik ','Nashik 171');
selbox.options[selbox.options.length] = new Option('Kolhapur ','Kolhapur 171');
selbox.options[selbox.options.length] = new Option('Ratnagiri ','Ratnagiri 171');
selbox.options[selbox.options.length] = new Option('Solhapur','Solhapur 171');
selbox.options[selbox.options.length] = new Option('Satara ','Satara 171');
selbox.options[selbox.options.length] = new Option('Sangli ','Sangli 171');
selbox.options[selbox.options.length] = new Option('Wada ','Wada 171');
selbox.options[selbox.options.length] = new Option('Thane ','Thane 171');
selbox.options[selbox.options.length] = new Option('Raigad ','Raigad 171');

	}
if (chosen == "New Delhi") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('New Delhi - Janakpuri ','New Delhi - Janakpuri 172');
selbox.options[selbox.options.length] = new Option('New Delhi - Karol Bagh ','New Delhi - Karol Bagh 173');
selbox.options[selbox.options.length] = new Option('New Delhi - Pitam Pura ','New Delhi - Pitam Pura 174');

	}
if (chosen == "Orissa") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Berhampur','Berhampur 175');
selbox.options[selbox.options.length] = new Option('Bhubaneswar','Bhubaneswar 176');
selbox.options[selbox.options.length] = new Option('Cuttack ','Cuttack 177');
selbox.options[selbox.options.length] = new Option('Raurkela','Raurkela 178');

	}
if (chosen == "Puducherry") 
	{
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Puducherry','Puducherry 179');

}
if (chosen == "Punjab") {
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Jalandhar','Jalandhar');

	}
	if (chosen == "Rajasthan") {
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Bikaner','Bikaner');
selbox.options[selbox.options.length] = new Option('Jaipur','Jaipur');
selbox.options[selbox.options.length] = new Option('Jodhpur','Jodhpur');
selbox.options[selbox.options.length] = new Option('Kota','Kota');
selbox.options[selbox.options.length] = new Option('Udaipur','Udaipur');

	}
	if (chosen == "Tamil Nadu") {
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Attur (salem)','Attur (salem)');
selbox.options[selbox.options.length] = new Option('Chennai','Chennai');
selbox.options[selbox.options.length] = new Option('Chennai - Kattankulathur','Chennai - Kattankulathur');
selbox.options[selbox.options.length] = new Option('Chidambaram','Chidambaram');
selbox.options[selbox.options.length] = new Option('Coimbatore','Coimbatore');
selbox.options[selbox.options.length] = new Option('Cuddalore','Cuddalore');
selbox.options[selbox.options.length] = new Option('Dharmapuri','Dharmapuri');
selbox.options[selbox.options.length] = new Option('Dindugal','Dindugal');
selbox.options[selbox.options.length] = new Option('Erode','Erode');
selbox.options[selbox.options.length] = new Option('Kancheepuram','Kancheepuram');
selbox.options[selbox.options.length] = new Option('Krishnagiri','Krishnagiri');
selbox.options[selbox.options.length] = new Option('Kumbakonam','Kumbakonam');
selbox.options[selbox.options.length] = new Option('Madurai','Madurai');
selbox.options[selbox.options.length] = new Option('Nagercoil','Nagercoil');
selbox.options[selbox.options.length] = new Option('Namakkal','Namakkal');
selbox.options[selbox.options.length] = new Option('Salem','Salem');
selbox.options[selbox.options.length] = new Option('Thanjavur','Thanjavur');
selbox.options[selbox.options.length] = new Option('Tiruchirapalli','Tiruchirapalli');
selbox.options[selbox.options.length] = new Option('Tirunelveli','Tirunelveli');
selbox.options[selbox.options.length] = new Option('Tiruvannamalai','Tiruvannamalai');
selbox.options[selbox.options.length] = new Option('Vellore','Vellore');

	}
	if (chosen == "Uttar Pradesh") {
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Allahabad','Allahabad');
selbox.options[selbox.options.length] = new Option('Bareilly','Bareilly');
selbox.options[selbox.options.length] = new Option('Faizabad','Faizabad');
selbox.options[selbox.options.length] = new Option('Ghaziabad','Ghaziabad');
selbox.options[selbox.options.length] = new Option('Gorakpur','Gorakpur');
selbox.options[selbox.options.length] = new Option('Jhansi','Jhansi');
selbox.options[selbox.options.length] = new Option('Kanpur ','Kanpur ');
selbox.options[selbox.options.length] = new Option('Lucknow','Lucknow');
selbox.options[selbox.options.length] = new Option('Meerut','Meerut');
selbox.options[selbox.options.length] = new Option('Noida','Noida');
selbox.options[selbox.options.length] = new Option('Varanasi','Varanasi');

	}
	if (chosen == "Uttaranchal") {
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Dehra Dun','Dehra Dun');

	}
		if (chosen == "West Bengal") {
		//document.getElementById("TestCity_tr").style.display="";
		selbox.options[selbox.options.length] = new Option('---Select---','');
		selbox.options[selbox.options.length] = new Option('Durgapur','Durgapur');
selbox.options[selbox.options.length] = new Option('Kolkata','Kolkata');
selbox.options[selbox.options.length] = new Option('Siliguri','Siliguri');

	}	
		
		if(chosen=='Uttaranchal' || chosen=='Arunachal Pradesh' || chosen=='Bihar' || chosen=='Chandigarh' || chosen=='Chattisgarh' || chosen=='Haryana' || chosen=='Himachal Pradesh' || chosen=='Jammu And Kashmir' || chosen=='Jharkhand' || chosen=='Madhya Pradesh' || chosen=='New Delhi' || chosen=='Punjab' || chosen=='Uttar Pradesh' || chosen=='Uttaranchal' )
			{
			  document.getElementById('txtCZone').value='North';
			}
		if(chosen=='West Bengal' || chosen=='Assam' || chosen=='Orissa' || chosen=='West Bengal' )
		{
		  document.getElementById('txtCZone').value='East';
		}
		
			if(chosen=='Gujarat'|| chosen=='Goa' || chosen=='Gujarat' || chosen=='Karnataka' || chosen=='Maharashtra' || chosen=='Rajasthan' )
			{
				
			  document.getElementById('txtCZone').value='West';
			}
				if(chosen=='Kerala' || chosen=='Andaman and Nicobar' || chosen=='Andhra Pradesh' || chosen=='Kerala' || chosen=='Puducherry' || chosen=='Tamil Nadu' )
				{
				  document.getElementById('txtCZone').value='South';
				}
}
				
function showTab(action){
	document.getElementById("thicktabs").style.display="";
	document.getElementById("tab_div").style.display="";
	document.getElementById("tab-1").style.backgroundImage="url(../images/tab_hover.png)";
}

function selectAll(){

    if(document.getElementById('chk_all').checked){
    	var chkObj = document.getElementsByName("chk_all");
    	for(var i=0;i<chkObj.length;i++){
    		var chkElement = chkObj[i];
    		//alert(" if chkElement: "+chkElement);
    		chkElement.checked = true;
    	}	
    }
    else{
    	var chkObj = document.getElementsByName("chk_all");
    	for(var i=0;i<chkObj.length;i++){
    		var chkElement = chkObj[i];
    		//alert("else chkElement: "+chkElement);
    		chkElement.checked = false;
    	}
    }
    
}	


function GenerateCatalogue()
{
	

window.open("/Yunysha/pdf/catelog.pdf");



}


function addNewRow(){
	var diamondCount = document.getElementById("diamondCount").value;
	diamondCount = parseInt(diamondCount)+1;
	
	var companyCode = document.getElementById("txtCode").value;
	var newRow = "<tr id='row"+diamondCount+"'><td><input type='text' size='10' class='text_field' name='"+companyCode+"_DCode_"+diamondCount+"' id='"+companyCode+"_DCode_"+diamondCount+"'></td>";
	newRow = newRow +	"<td><input type='text' size='15' class='text_field' name='"+companyCode+"_DShape_"+diamondCount+"' id='"+companyCode+"_DShape_"+diamondCount+"'></td>";
	newRow = newRow +	"<td><input type='text' size='15' class='text_field' name='"+companyCode+"_DMake_"+diamondCount+"' id='"+companyCode+"_DMake_"+diamondCount+"'></td>";
	newRow = newRow +	"<td><input type='text' size='15' class='text_field' name='"+companyCode+"_DClarity_"+diamondCount+"' id='"+companyCode+"_DClarity_"+diamondCount+"'></td>";
	newRow = newRow +	"<td><input type='text' size='15' class='text_field' name='"+companyCode+"_DColor_"+diamondCount+"' id='"+companyCode+"_DColor_"+diamondCount+"'></td>";
	newRow = newRow + 	"<td><input type='text' size='10' class='text_field' name='"+companyCode+"_DSieve_"+diamondCount+"' id='"+companyCode+"_DSieve_"+diamondCount+"'></td>";
	newRow = newRow + 	"<td><input type='text' size='10' class='text_field' name='"+companyCode+"_DWeight_"+diamondCount+"' id='"+companyCode+"_DWeight_"+diamondCount+"'></td>";
	newRow = newRow + 	"<td><input type='text' size='10' class='text_field' name='"+companyCode+"_DBP_"+diamondCount+"' id='"+companyCode+"_DBP_"+diamondCount+"'></td>";
	newRow = newRow +	"<td><input type='text' size='10' class='text_field' name='"+companyCode+"_DSP_"+diamondCount+"' id='"+companyCode+"_DSP_"+diamondCount+"'></td>";
	newRow = newRow +   "<td><img src='images/deleteRow.jpg' height='20px' onclick='deleteRow("+diamondCount+")'/></td></tr>";
	
	
	var tableHtml = document.getElementById("diamondDetails_body").innerHTML;
	
	tableHtml = tableHtml + newRow;
	
	document.getElementById("diamondDetails_body").innerHTML = tableHtml;
	
	
	document.getElementById("diamondCount").value =diamondCount;
	
	
}

function addNewRow(){
	var diamondCount = document.getElementById("diamondCount").value;
	diamondCount = parseInt(diamondCount)+1;
	
	var companyCode = document.getElementById("txtCode").value;
	var newRow = "<tr id='row"+diamondCount+"'><td><input type='text' size='10' class='text_field' name='"+companyCode+"_DCode_"+diamondCount+"' id='"+companyCode+"_DCode_"+diamondCount+"'></td>";
	newRow = newRow +	"<td><input type='text' size='15' class='text_field' name='"+companyCode+"_DShape_"+diamondCount+"' id='"+companyCode+"_DShape_"+diamondCount+"'></td>";
	newRow = newRow +	"<td><input type='text' size='15' class='text_field' name='"+companyCode+"_DMake_"+diamondCount+"' id='"+companyCode+"_DMake_"+diamondCount+"'></td>";
	newRow = newRow +	"<td><input type='text' size='15' class='text_field' name='"+companyCode+"_DClarity_"+diamondCount+"' id='"+companyCode+"_DClarity_"+diamondCount+"'></td>";
	newRow = newRow +	"<td><input type='text' size='15' class='text_field' name='"+companyCode+"_DColor_"+diamondCount+"' id='"+companyCode+"_DColor_"+diamondCount+"'></td>";
	newRow = newRow + 	"<td><input type='text' size='10' class='text_field' name='"+companyCode+"_DSieve_"+diamondCount+"' id='"+companyCode+"_DSieve_"+diamondCount+"'></td>";
	newRow = newRow + 	"<td><input type='text' size='10' class='text_field' name='"+companyCode+"_DWeight_"+diamondCount+"' id='"+companyCode+"_DWeight_"+diamondCount+"'></td>";
	newRow = newRow + 	"<td><input type='text' size='10' class='text_field' name='"+companyCode+"_DBP_"+diamondCount+"' id='"+companyCode+"_DBP_"+diamondCount+"'></td>";
	newRow = newRow +	"<td><input type='text' size='10' class='text_field' name='"+companyCode+"_DSP_"+diamondCount+"' id='"+companyCode+"_DSP_"+diamondCount+"'></td>";
	newRow = newRow +   "<td><img src='images/deleteRow.jpg' height='20px' onclick='deleteRow("+diamondCount+")'/></td></tr>";
	
	
	var tableHtml = document.getElementById("diamondDetails_body").innerHTML;
	
	tableHtml = tableHtml + newRow;
	
	document.getElementById("diamondDetails_body").innerHTML = tableHtml;
	
	
	document.getElementById("diamondCount").value =diamondCount;
	
	
}

function deleteRow(rowNum){
	var trId = "row"+rowNum;
	$('#' + trId).remove();
}

function addNewContactRow(){
	var contactCount = document.getElementById("contactCount").value;
	contactCount = parseInt(contactCount)+1;
	
	if(document.getElementById('txtContactPosition1').value == ""){
		alert("Please select Owner/Partner Position at row 1 before adding new row.");
		return false;
	}else if(document.getElementById('txtContactName1').value == ""){
		alert("Please enter Owner/Partner Name at row 1 before adding new row.");
		return false;
	}else if(document.getElementById('txtContactNo1').value == ""){
		alert("Please enter Owner/Partner Contact No at row 1 before adding new row.");
		return false;
	}else if(document.getElementById('txtContactMobileNo1').value == ""){
		alert("Please enter Owner/Partner Mobile No at row 1 before adding new row.");
		return false;
	}else if(document.getElementById('txtContactEmail1').value == ""){
		alert("Please enter Owner/Partner Email Address at row 1 before adding new row.");
		return false;
	}else if(document.getElementById('txtContactPincode1').value == ""){
		alert("Please enter Owner/Partner Contact Pincode at row 1 before adding new row.");
		return false;
	}
	
	var newRow = "<tr id='contactRow"+contactCount+"'><td><select class='Country_field' id='txtContactPosition"+contactCount+"' name='txtContactPosition"+contactCount+"'><option value='' selected='selected'>--Select--</option><option value='Owner/Partner'>Owner/Partner</option><option value='Order Concerned Person'>Order Concerned Person</option><option value='Accountant'>Accountant</option><option value='Clerk'>Clerk</option><option value='Others'>Others</option></select></td>";
	newRow = newRow + "<td><input type='text' size='10' class='text_field' name='txtContactName"+contactCount+"' id='txtContactName"+contactCount+"'></td>";
	newRow = newRow + "<td><input type='text' size='15' class='text_field' name='txtContactNo"+contactCount+"' id='txtContactNo"+contactCount+"'></td>";
	newRow = newRow + "<td><input type='text' size='15' class='text_field' name='txtContactMobileNo"+contactCount+"' id='txtContactMobileNo"+contactCount+"'></td>";
	newRow = newRow + "<td><input type='text' size='15' class='text_field' name='txtContactEmail"+contactCount+"' id='txtContactEmail"+contactCount+"'></td>";
	newRow = newRow + "<td><input type='text' size='15' class='text_field' name='txtContactFax"+contactCount+"' id='txtContactFax"+contactCount+"'></td>";
	newRow = newRow + "<td><input type='text' size='15' class='text_field' name='txtContactPincode"+contactCount+"' id='txtContactPincode"+contactCount+"'></td>";
	newRow = newRow + "<td><img src='images/deleteRow.jpg' onclick='deleteContactRow("+contactCount+")' height='20px'/></td></tr>";
	 
	
	var tableHtml = document.getElementById("ownerContact_body").innerHTML;
	tableHtml = tableHtml + newRow;
	document.getElementById("ownerContact_body").innerHTML = tableHtml;
	document.getElementById("contactCount").value =contactCount;
}

function deleteContactRow(rowNum){
	var trId = "contactRow"+rowNum;
	$('#' + trId).remove();
}

                  
function open_win()
{
window.open("http://localhost:8080/Yunysha/jsp/fileUpload.jsp","_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=400, height=200");
}

function fnGetXMLHttpObject(){
	var http_req = null;	   
	if (window.XMLHttpRequest){ // Mozilla, Safari,...
		http_req = new XMLHttpRequest();
		
		if (http_req.overrideMimeType)
		{
			http_req.overrideMimeType('text/xml');
		}
		return http_req;
	}else if (window.ActiveXObject){ // IE		           
		try {
			http_req = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try {
				http_req = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(e){}
		}
		return http_req;
	}
	
	return http_req;
}

function fnGetDependentData(tableName,masterValue,selectFields,whereFields,fieldRemoveDataHTMLName,fieldHTMLName){
var http_request=fnGetXMLHttpObject();
//var orgid=document.onlineAppForm.orgId.value;
var orgid=document.getElementById('orgId').value;
var parameters = "Common"+","+tableName+","+masterValue+","+selectFields+","+whereFields+","+orgid+","+fieldHTMLName;
if(http_request!=null){
	var pValidationServlet = "DependentServlet"; 
	http_request.open('POST',pValidationServlet,true);       
	http_request.onreadystatechange = function() { fnPopulateDependentData(http_request,fieldRemoveDataHTMLName,fieldHTMLName); }; 	 	                    
	http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");               
	http_request.send("para="+parameters);
}
}



function fnPopulateDependentData(http_request,fieldRemoveDataHTMLName,fieldHTMLName){
if(http_request.readyState == 4){
	if (http_request.status == 200){
		if(http_request.responseText != null){
        	var fieldRemoveHTMLCount=fieldRemoveDataHTMLName.split(",");			
			for(var k=0;k<fieldRemoveHTMLCount.length;k++){
				fieldRemoveName=fieldRemoveHTMLCount[k];
				if(document.getElementById(fieldRemoveName)!=null){
					if(document.getElementById(fieldRemoveName).tagName=="SELECT"){
						var siteRemoveList = document.getElementById(fieldRemoveName);
						removeChildren = siteRemoveList.childNodes.length;
						for(var countRemove=0;countRemove<removeChildren;countRemove++)
						{
							siteRemoveList.removeChild(siteRemoveList.childNodes[0]);
							//alert(siteList.childNodes[count]);
						}
					}	
				}
			}
			
			var fieldHTMLCount=fieldHTMLName.split(",");
							
			for(var j=0;j<fieldHTMLCount.length;j++){
				fieldName=fieldHTMLCount[j];
				
				if(document.getElementById(fieldName)!=null){
									
					if(document.getElementById(fieldName).tagName=="SELECT"){
						var siteList = document.getElementById(fieldName);
						var fieldOtherName="txt"+fieldName;
					
						document.getElementById(fieldName).style.display="block";
						document.getElementById(fieldOtherName).style.display="none";
             	 		siteList.options[0] = new Option('----Select-----','0');
             	 	
						var siteCode = new Array();
            			var siteName = new Array();
            			var i=1;
            			var responseDoc= http_request.responseXML;	
            			var htmlName = responseDoc.getElementsByTagName("RESPONSE");
						var fieldCheck=htmlName[0].getAttribute("fieldhtmlname"); 
						var docs = responseDoc.getElementsByTagName("ROW");
						var noOfDocuments = docs.length;
						
						if(fieldCheck==fieldName){
							if(noOfDocuments > 0){					 
								for(count=0;count<noOfDocuments;count++)		//loop document
			 	    			{	
			 						var docFields=docs[count].getElementsByTagName("FIELD");
			 						
			 						for(fieldCount=0;fieldCount<docFields.length;fieldCount++){
										siteCode[fieldCount] = docFields[fieldCount].getAttribute("fieldname");
										siteName[fieldCount] = docFields[fieldCount].firstChild.nodeValue;
										siteName[fieldCount+1] = docFields[fieldCount+1].firstChild.nodeValue;
										siteList.options[i] = new Option(siteName[fieldCount+1],siteName[fieldCount]);
										fieldCount=fieldCount+1;
										i++;
									}
				   				}				   		
							}
							else{
								document.getElementById(fieldOtherName).style.display="block";
								document.getElementById(fieldName).style.display="none";
							}
						}
						else{
							//alert("Create a Textbox here");
							document.getElementById(fieldOtherName).style.display="block";
							document.getElementById(fieldName).style.display="none";
						}
					}
					else if(document.getElementById(fieldName).tagName=="SPAN"){
						var siteList = document.getElementById(fieldName);
						var siteCode = new Array();
            			var siteName = new Array();
						var hdnField=fieldName+"Hdn";
						var responseDoc= http_request.responseXML;
						var htmlName = responseDoc.getElementsByTagName("RESPONSE");
						var fieldCheck=htmlName[0].getAttribute("fieldhtmlname"); 
						var docs = responseDoc.getElementsByTagName("ROW");
						var noOfDocuments = docs.length;
						if(document.getElementById(hdnField).type=="hidden"){
							var hdnValue=document.getElementById(hdnField).value;
							var htmlElement="";
							if(hdnValue=="checkbox"){
								for(count=0;count<noOfDocuments;count++)		//loop document
			 	    			{
			 	    					htmlElement=htmlElement+"<input type='checkbox' value='";
										var docFields=docs[count].getElementsByTagName("FIELD");
									
										for(fieldCount=0;fieldCount<docFields.length;fieldCount++){
											if(fieldCount==0){
												siteName[fieldCount] = docFields[fieldCount].firstChild.nodeValue;
												htmlElement=htmlElement+siteName[fieldCount]+"' id='";
											}
											else if(fieldCount>0){
												siteCode[fieldCount] = docFields[fieldCount].getAttribute("fieldname");
												siteName[fieldCount] = docFields[fieldCount].firstChild.nodeValue;
												htmlElement=htmlElement+siteCode[fieldCount]+"_Chk"+(count+1)+"' name='"+fieldCheck+"' >";
											}
										}
									
										htmlElement=htmlElement+siteName[1]+" ";
									
			 	    			}
								
								siteList.innerHTML=htmlElement;
							}
						}
					}
				}
			}
       }
	} 
}
}

